<div class="full-screen">
    <header>
    <div class="a-bar">
        <a href="javascript:history.back()" class="a-back">
            <i class="arr left"></i>
            返回
        </a>
        <div class="a-name">
            我的订单
        </div>
    </div>
    </header>
    <div class="full-padding">
        <ul class="mem-order-list">
            <{foreach from=$orders item="order" name=orders key="key"}>
            <li class="mem-order-item">
            <table width="100%">
                <tr width="100%">
                    <td width="50%" class="l-v">                    
                        <!-- <div class="l-k">订单号：</div> -->
                        <!-- <div class="l-v"> -->
                        订单号：<{$order.order_id}>
                        <!-- </div> -->
                    </td>
                    <td colspan="2" width="200%"  class="icon orange">
                        <!--  退款oms 会改变 ship_status为0 2个判定以区分是否是退款单  qianjin 2016-4-15  -->
                        <{if $order.received_status == 1 && $order.ship_status == '1'}>
                            <{t}>已完成[确认收货]<{/t}>
                        <{else}>           
                            <{switch from=$order.status}>
                            <{case value='finish'}><{t}>已完成<{/t}>
                            <{case value='dead'}><{t}>已作废<{/t}>
                            <{case}>
                            <{switch from=$order.pay_status}>
                            <{case value='1'}><{t}>已付款<{/t}>
                            <{switch from=$order.ship_status}>
                            <{case value='1'}><{t}>[已发货]<{/t}>
                            <{case value='2'}><{t}>[部分发货]<{/t}>
                            <{case value='3'}><{t}>[部分退货]<{/t}>
                            <{case value='4'}><{t}>[已退货]<{/t}>
                            <{case}><{t}>[正在备货]<{/t}>
                            <{/switch}>
                            <{case value='2'}><{t}>已付款至担保方<{/t}>
                            <{case value='3'}><{t}>等待补款<{/t}>
                            <{switch from=$order.ship_status}>
                            <{case value='1'}><{t}>[已发货]<{/t}>
                            <{case value='2'}><{t}>[部分发货]<{/t}>
                            <{case value='3'}><{t}>[部分退货]<{/t}>
                            <{case value='4'}><{t}>[已退货]<{/t}>
                            <{/switch}>
                            <{case value='4'}><{t}>部分退款<{/t}>
                            <{switch from=$order.ship_status}>
                            <{case value='0'}><{t}>[未发货]<{/t}>
                            <{case value='1'}><{t}>[已发货]<{/t}>
                            <{case value='2'}><{t}>[部分发货]<{/t}>
                            <{case value='3'}><{t}>[部分退货]<{/t}>
                            <{case value='4'}><{t}>[已退货]<{/t}>
                            <{/switch}>
                            <{case value='5'}><{t}>已退款<{/t}>
                            <{switch from=$order.ship_status}>
                            <{case value='0'}><{t}>[未发货]<{/t}>
                            <{case value='1'}><{t}>[已发货]<{/t}>
                            <{case value='2'}><{t}>[部分发货]<{/t}>
                            <{case value='3'}><{t}>[部分退货]<{/t}>
                            <{case value='4'}><{t}>[已退货]<{/t}>
                            <{/switch}>
                            <{case}><{t}>等待付款<{/t}>
                            <{switch from=$order.ship_status}>
                            <{case value='1'}><{t}>[已发货]<{/t}>
                            <{case value='2'}><{t}>[部分发货]<{/t}>
                            <{case value='3'}><{t}>[部分退货]<{/t}>
                            <{case value='4'}><{t}>[已退货]<{/t}>
                            <{/switch}>
                            <{/switch}>
                            <{/switch}>
                        <{/if}>
                        </div>
                    </td>
                    <td style="text-align: right;">
                        <!-- <div class="t-r"> -->
                        <a href="<{link app=b2c ctl="wap_member" act="orderdetail" arg0=$order.order_id}>">
                            <i class="arr right"></i>
                        </a>
                        <!-- </div> -->
                    </td>
                </tr>
                <!-- 我的订单界面显示 by qianyi-->
                <{foreach from=$order.goods_items item=item_goods name=goods_item}>
                <tr width="100%">
                <td colspan="3">
                <ul >
                        <!-- goods -->
                        <{if $order.goods_items}>
                            <!-- goods -->
                            <{if $item_goods.product}>
                            <span><li class="mem-pt-item">
                                <a href='<{$item_goods.product.link_url}>' title="<{$item_goods.product.quantity}>--<{$item_goods.product.name}>">
                                <img src='<{$item_goods.product.thumbnail_pic|default:$env.conf.site.default_thumbnail_pic|storager:'s'}>' />
                                </a>
                                <!-- <i class="num"><{$item_goods.product.quantity}></i> -->
                            </li></span>
                            <span>&nbsp&nbsp<{$item_goods.product.name}></span>
                            <span style="float:right;color:#ff0000;"><{$item_goods.product.price}></span>
                            </br>
                            <span style="float:right;">X<{$item_goods.product.quantity}></span>
                            <{/if}>
                            <!-- adjunct -->
                            <{if $item_goods.adjunct_items}>
                                <{foreach from=$item_goods.adjunct_items item=item_adjunct name=adjunct_item}>
                                <li class="mem-pt-item">
                                    <a href='<{$item_adjunct.link_url}>' title="<{$item_adjunct.quantity}>--<{$item_adjunct.name}>--配件">
                                    <img src="<{$item_adjunct.thumbnail_pic|default:$env.conf.site.default_thumbnail_pic|storager:'s'}>"/>
                                    </a>
                                    <i class="num"><{$item_adjunct.quantity}></i>
                                    <i class="icon red">配件</i>
                                </li>
                                <{/foreach}>
                            <{/if}>
                            <!-- gift -->
                            <{if $item_goods.gift_items}>
                                <{foreach from=$item_goods.gift_items item=item_gift name=gift_item}>
                                <li class="mem-pt-item">
                                  <a href='<{$item_gift.link_url}>' title="<{$item_gift.quantity}>-- <{$item_gift.name}>--赠品">
                                    <img src="<{$item_gift.thumbnail_pic|default:$env.conf.site.default_thumbnail_pic|storager:'s'}>"/>
                                    </a>
                                    <i class="num"><{$item_gift.quantity}></i>
                                    <i class="icon red">赠品</i>
                                </li>
                                <{/foreach}>
                            <{/if}>
                        <{/if}>
                    <{/foreach}>

                    <!-- gift -->
                    <{if $order.gift_items}>
                        <{foreach from=$order.gift_items item=item_gift name=gift_item}>
                        <li class="mem-pt-item">
                            <a href='<{$item_gift.link_url}>' title="<{$item_gift.quantity}>--<{$item_gift.name}>--赠">
                            <img src="<{$item_gift.thumbnail_pic|default:$env.conf.site.default_thumbnail_pic|storager:'s'}>"/>
                            </a>
                            <i class="num"><{$item_gift.quantity}></i>
                            <i class="icon red">赠品</i>
                         </li>
                        <{/foreach}>
                    <{/if}>

                    <!-- extends -->
                    <{if $order.extends_items}>
                        <{foreach from=$order.extends_items item=item_extends name=item_extends}>
                            <{$item_extends}>
                        <{/foreach}>
                    <{/if}>
                </ul>
                </td>
                </tr>
                <tr width="100%">
                    <td width="50%">
                        <div class="d-line">
                            <div class="l-k">合计：</div>
                            <div class="l-v">
                                <span class="price"><{$order.cur_amount|cur_odr:$order.currency:false:true}></span>
                            </div>  
                        </div>                      
                    </td>
                    <td width="20%">
                            <!-- <div class="l-k">支付方式：</div> -->
                            <div class="l-v">
                                <{$order.payinfo.pay_app_id|pay_name}>
                            </div>                        
                    </td>
                    <td width="30%">
                            <!-- <div class="l-k">订单时间：</div> -->
                            <div class="l-v">
                                <{$order.createtime|cdate:FDATE_STIME}>
                            </div>                        
                    </td>
                </tr>
                <tr width="100%">
                    <td  colspan="2" style="text-align: right;">                  
                    </td>
                    <td style="text-align: right; ">
                    <{if $order.status == 'active' && $order.pay_status == '0' && $order.ship_status == '0' }>
                        <div style=" border: none;display: inline-block;outline: 0;padding: 6px 10px;margin-bottom: 10px;vertical-align: middle;overflow: hidden;text-decoration: none;color: #fff;background-color: #F88E8B;text-align: center;transition: .2s ease-out;cursor: pointer;white-space: nowrap;box-shadow: 0px 1px 3px rgba(0,0,0,0.12), 0px 1px 2px rgba(0,0,0,0.24);border-radius: 10px">
                            <a href="<{link app=b2c ctl="wap_member" act="cancel" arg0=$order.order_id}>">
                               取消
                                <!-- <i class="arr right"></i> -->
                            </a>
                        </div>
                    <{/if}>                   
                    <!-- <div class="t-r"> -->
                        <{if $order.status == 'active' && ($order.pay_status=='0' || $order.pay_status=='3')}>
                        <{if $order.payinfo.pay_app_id != '-1'}>
                            <div style=" border: none;display: inline-block;outline: 0;padding: 6px 10px;margin-bottom: 10px;vertical-align: middle;overflow: hidden;text-decoration: none;color: #fff;background-color: #F88E8B;text-align: center;transition: .2s ease-out;cursor: pointer;white-space: nowrap;box-shadow: 0px 1px 3px rgba(0,0,0,0.12), 0px 1px 2px rgba(0,0,0,0.24);border-radius: 10px">
                            <a  href="<{link app=b2c ctl=wap_paycenter act=index arg0=$order.order_id}>" >
                                支付
                                <!-- <i class="arr right"></i> -->
                            </a>
                            </div>
                            <{/if}>
                            <{/if}>
                        <!-- </div> -->
                                            
                        <{if $order.status != 'dead' && $order.ship_status =="1" && $order.received_status =='0'}>

                            <a href="javascript:void(0);" onclick="return receive('<{$order.url}>')">
                               确认收货
                                <i class="arr right"></i>
                            </a>
                        </div>
                        
                        <{/if}>
                        <{if $order.status != 'dead' && $order.ship_status =="2" && $order.received_status =='0'}>
                        <div class="t-r">
                            <a style="color:#999;cursor:default;" href="javascript:void(0);">
                               确认收货
                                <i class="arr right"></i>
                            </a>
                        </div>
                    </td>
                    <{/if}>

                    
                </tr>
            </table>            
            
            </li>
            <hr width="100%" color=#C5C5C5 SIZE=5/>
            <{/foreach}>
        </ul>
    </div>
</div>
<{wap_pagers data=$pager}>
<script>
function receive(url){
    var xmlHttp;
    try{
        xmlHttp=new XMLHttpRequest();        
    }catch(e){
        try{
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
            try{
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }catch(e){
                return false;
            }
        }
    }
    xmlHttp.open('post',url);
    xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            alert('已完成收货');
            location.reload();
        }
    }
        xmlHttp.send(null);
}
</script>
